package Demo.Pojo;

public class Book {
    private int id;
    private String title;
    private String author;
    private int year;
    private String isbn;

    // 构造函数
    public Book(String title, String author, int year, String isbn) {

        this.title = title;
        this.author = author;
        this.year = year;
        this.isbn = isbn;
    }

    public Book(int id, String title, String author, int year, String isbn) {
        this.id = id;
        this.title = title;
        this.author = author;
        this.year = year;
        this.isbn = isbn;
    }

    // Getter 和 Setter 方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    // toString 方法，用于在表格中显示图书信息
    @Override
    public String toString() {
        return "Book{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", author='" + author + '\'' +
                ", year=" + year +
                ", isbn='" + isbn + '\'' +
                '}';
    }

    // 如果需要在JavaFX的TableView中显示，可以添加属性的绑定支持
    // 例如，使用StringProperty代替String存储标题
    // 以及相应的getter和setter方法
}